<%@ page contentType="text/html;charset=utf-8" language="java"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@include file="./common/base.jsp" %><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户中心_约导游</title>
<!--css-->
<link rel="stylesheet" type="text/css" href="css/wutongstyle.css">
<link rel="stylesheet" type="text/css" href="city/citySelector.css">
<script src="city/citySelector.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
</head>
<body>
<!--head begin-->
<%@ include  file="./common/header.jsp"%>
<!--nav end--> 
<!--content begin-->
<div class="wt_content">
  <dl class="yuedaoyou">
	<%@ include  file="./common/header2.jsp"%><dd>
    <dd>
      <div class="daoyou_info clearfix">
        <div class="xx_box">
          <div class="tainfobox yonghu">
            <h3 id="tuan"><i class="i_co"></i>编辑团信息</h3>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="biaodan">
              <tr>
                <td><input type="hidden" id="pkId" value=""></td>
              </tr>
              <tr>
                <td class="title">发团标题：</td>
                <td><input type="text" id="teamTitleId" value=""></td>
              </tr>
              <tr>
                <td class="title">出发时间：</td>
                <td><input type="text" id="startTimeId" class="Wdate" value="" onClick="WdatePicker({minDate:'%y-%M-%d'})"></td>
              </tr> 
              <tr>
                <td class="title">出发地点：</td>
                <td><input type="text" id="sourceCityId" class="cityinput" value=""></td>
              </tr>
              <tr>
                <td class="title">目的地：</td>
                <td><input type="text" id="targetCityId" class="cityinput" value=""></td>
              </tr>
              <tr>
                <td class="title">是否出境：</td>
                <td>
                <input style="width:15px;height:15px;margin-left:10px;" type="radio" name="isoutboundId" value="1">是<input style="width:15px;height:15px;margin-left:10px;" type="radio" name="isoutboundId" value="0" checked>否
                <!--  <input type="text" id="isoutboundId" value="">-->
                </td>
              </tr>
               <tr>
                <td class="title">全陪地陪：</td>
                <td>
                <input style="width:15px;height:15px;margin-left:10px;" type="radio" name="keepstatus" value="1">全陪<input style="width:15px;height:15px;margin-left:10px;" type="radio" name="keepstatus" value="0" checked>地陪
                <!--  <input type="text" id="isoutboundId" value="">-->
                </td>
              </tr>
              <tr>
                <td class="title">总天数：</td>
                <td><input type="text" id="daysId" value=""></td>
              </tr>
              <tr>
                <td class="title">导服：</td>
                <td><input type="text" id="guidecostId" value=""></td>
              </tr>
              <tr>
                <td class="title">旅游行程：</td>
                <td><textarea name="" id="tripId" cols="" rows=""></textarea></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td><button type="button" value="确认发布" onclick="modifyTravelTeam()">确认发布</button></td>
              </tr>
            </table>
          </div>
        </div>
        <div class="zp"><img id="headImgId" src="" width="185" height="90" />
          <div class="tel">
            <h4>快捷菜单</h4>
            <ul class="quick">
                <li><a href="lxslogin_1.jsp" >发布新团信息</a></li>
              <li><a href="lxslogin.jsp">团信息列表</a></li>
              <li><a href="lxslogin_2.jsp" class="on">新发团信息</a></li>
              <li><a href="lxslogin_3.jsp">已申请信息</a></li>
              <li><a href="lxslogin_4.jsp">已确认信息</a></li>
              <li><a href="lxslogin_6.jsp" >已发团信息</a></li>
              <li><a href="lxslogin_5.jsp">我的资料</a></li>
              <li><a href="lxslogin_7.jsp">站内短信列表</a></li>
            </ul>
          </div>
          <div class="yhsousuo">
            <h4>搜索导游信息</h4>
            <input type="text" value="填写城市名称">
            <button type="submit" value="搜索">搜索</button>
          </div>
        </div>
      </div>
    </dd>
  </dl>
</div>
<!--content end--> 
<!--footer begin-->
<%@ include  file="./common/footer.jsp"%>
<!--footer end-->
</body>
<script type="text/javascript">
var teamId = request("teamId");
$(function(){
	$("#headImgId").attr("src",imgDomain+"${loginDetail.photo}");
	loadLxsTeamDetail(teamId);
	new Vcity.CitySelector({input:'sourceCityId'});
	new Vcity.CitySelector({input:'targetCityId'});
});
function loadLxsTeamDetail(id) {
	var objp={};
	 $.ajax({
		  url: '${path}/core/getTravelTeamById?id='+teamId,
		  type: 'POST',
		  timeout: 30000,
		  cache : false,
	      data :objp,
	      async: false,
	      dataType:"json",      
         contentType:"application/json",   
	     // contentType: "application/json; charset=utf-8",
		  success:function(msg){
			  //alert(msg.totalCount)
			  formatLxsTeamDetail(msg.travelTeam);
		  },
		   failure:function(msg){
			   alert(eval('('+msg.responseText+')').error_text);
		   		
		   },
		   error:function(msg){
			   alert(eval('('+msg.responseText+')').error_text); 
		   }
	});
}

function formatLxsTeamDetail(data) {
	$("#pkId").val(data.id);
	$("#teamTitleId").val(data.teamtitle);
	$("#startTimeId").val(data.startTime);
	$("#sourceCityId").val(data.sourcecity);
	$("#targetCityId").val(data.targetcity);
	$("#guidecostId").val(data.guidecost);
	$("input[name='isoutboundId'][value="+data.isoutbound+"]").attr("checked",true); 
	$("input[name='keepstatus'][value="+data.keepstatus+"]").attr("checked",true); 
	$("#daysId").val(data.days);
	$("#tripId").val(data.trip);
}

function modifyTravelTeam() {
	var id= $("#pkId").val();
	var teamTitle =$("#teamTitleId").val();
	var startTime = $("#startTimeId").val();
	var sourceCity = $("#sourceCityId").val();
	var targetCity = $("#targetCityId").val();
	var isoutbound = $("input[name='isoutboundId']:checked").val(); //$("#isoutboundId").val();
	var keepstatus = $("input[name='keepstatus']:checked").val(); //$("#isoutboundId").val();
	var guidecost =  $("#guidecostId").val();
	var days = $("#daysId").val();
	var trip = escape($("#tripId").val());
	
	var objp= "{\"teamtitle\":\""+teamTitle+"\","+
				"\"id\":\""+id+"\","+
				"\"startTime\":\""+startTime+"\","+
				"\"sourcecity\":\""+sourceCity+"\","+
				"\"targetcity\":\""+targetCity+"\","+
				"\"isoutbound\":"+isoutbound+","+
				"\"keepstatus\":"+keepstatus+","+
				"\"guidecost\":"+guidecost+","+
				"\"days\":"+days+","+
		         "\"trip\":\""+trip+"\""+
		         "}";
	   $.ajax({
			  url: '${path}/core/modifyTravelTeam',
			  type: 'POST',
			  timeout: 30000,
			  cache : false,
		      data :objp,
		      async: false,
		      dataType:"json",      
	          contentType:"application/json",   
		     // contentType: "application/json; charset=utf-8",
			  success:function(msg){
				 history.go(-1);
			  },
			   failure:function(msg){
				   alert(eval('('+msg.responseText+')').error_text);
			   		
			   },
			   error:function(msg){
				   alert(eval('('+msg.responseText+')').error_text); 
			   }
		});
}
</script>
</html>
